import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  public picUrl = "https://pics4.baidu.com/feed/c995d143ad4bd1134f6b606bda01eb074afb057f.jpeg?token=bb4e86e7367b0fef1705dd9485cf0e36";

  public list:any[] = [
    {
      title: '我是新闻1'
    },
    {
      title: '我是新闻2'
    },
    {
      title: '我是新闻3'
    }
  ]

  public flag:boolean = true;

  
  /**
   * 1表示已支付，
   * 2表示支付并且确认订单
   * 3表示已经发货
   * 4表示已经收货
   * 5表示无效
   */
  public orderStatus: number=1; 

  public attr:string='red'

  public today:any=new Date();

  public title:string = "我是一个title"

  public keywords:string = "我是默认值";

  constructor() { 
    console.log(this.today)
  }

  ngOnInit(): void {
  }

  run() {
    alert("执行方法了")
  }

  getData() {
    alert(this.title)
  }

  changeData() {
    this.title="我是改变后的title";
  }

  keyDown(e:any) {
    if(e.keyCode==13) {
      console.log("按了一下回车1")
    }
    else{
      console.log(e.keyCode)
    }
  }

  keyUp(e:any) {
    if(e.keyCode==13) {
      console.log("按了一下回车2")
    }
    else{
      console.log(e.target.value)
    }
  }

  getEvent(event:any) {
    let dom:any = event.target;
    dom.style.color="red";
  }
  changekeywords() {
    this.keywords="我是改变的关键词";
  }
  getkeywords() {
    console.log(this.keywords);
  }
}
